<template>
    <div v-if="showGd">
    <square-button :title="title" v-on="$listeners" v-bind="$attrs"
                   @click="showDialog" icon="el-icon-folder-checked"></square-button>
        <gui-dang-dialog :row="row" @reloadList="reloadList" :visible.sync="visible" v-if="visible"></gui-dang-dialog>
    </div>
</template>
<script>
    import SquareButton from "@/components/WorkFlowsDialog/Case/SquareButton";
    import GuiDangDialog from "../GuiDangDialog";
    export default {
        name: "GuiDangButton",
        components: {GuiDangDialog, SquareButton},
        props:["row"],
        data() {
            return {
                visible:false,
                title:this.row.is_gd?'已归档':'归档'
            }
        },
        computed: {
            showGd(){
                return this.hasPermissions('guidang')&&(this.row.act_state_id==4||this.row.act_state_id==5)
            }
        },
        created() {
        },
        methods: {
            showDialog(){
                if(!this.row.is_gd){
                    this.visible = true
                }
            },
            reloadList(){
                this.row.is_gd=true
            }
        }
    }
</script>

